package com.pan.controller.Operations;

import com.pan.aop.BusinessType;
import com.pan.aop.MyLog;
import com.pan.controller.tools.Methods;
import com.pan.controller.tools.R1;
import com.pan.service.IAopLogService;
import com.pan.service.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/seeallaop")
@Tag(name = "SeeAllAopController",description = "查看所有用户日志")
public class SeeAllAopController {
    @Autowired
    private IAopLogService aopLogService;
    @Autowired
    private IUserService userService;

    Methods methods = new Methods();

    @Operation(summary = "操作员查看日志信息")
    @GetMapping
    @MyLog(title = "操作员查看日志信息",optParam = "无",businessType = BusinessType.SELECT)
    public R1 getAllAop(HttpServletRequest request){
        //检查用户权限
        if (methods.isYanfa(request,userService)){
            return new R1(true,aopLogService.seeAllAop());
        }
        return new R1(false,"权限不足！");
    }
}
